﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using Microsoft.WowAddonStudio.Lua.LanguageService.Model;
using Microsoft.WowAddonStudio.Lua.Model;

namespace Microsoft.WowAddonStudio.Lua.LanguageService.Intellisense.Providers
{
    public class TraceDeclarationProvider : QualifiedNameDeclarationProvider
    {
        protected override IEnumerable<Declaration> GetDeclarations(QualifiedName qualifiedName)
        {
            if (Request.HasQualifiedName)
                Trace.WriteLine(String.Format("QualifiedName: {0}", qualifiedName));
            Trace.WriteLine(String.Format("GetDeclarations: Line = {0}, Column = {1}, Reason = {2}", Request.Line, Request.Col, Request.Reason));

            return base.GetDeclarations(qualifiedName);
        }

        protected override IEnumerable<Function> GetMethods(QualifiedName qualifiedName)
        {
            Trace.WriteLine(String.Format("QualifiedName: {0}", qualifiedName));
            Trace.WriteLine(String.Format("GetMethods: Line = {0}, Column = {1}, Reason = {2}", Request.Line, Request.Col, Request.Reason));

            return base.GetMethods(qualifiedName);
        }

        protected override DataTip GetDataTip(QualifiedName qualifiedName)
        {
            Trace.WriteLine(String.Format("QualifiedName: {0}", qualifiedName));
            Trace.WriteLine(String.Format("GetDataTip: Line = {0}, Column = {1}", Request.Line, Request.Col));

            return base.GetDataTip(qualifiedName);
        }

        protected override DeclarationSource GetDeclarationSource(QualifiedName qualifiedName)
        {
            Trace.WriteLine(String.Format("QualifiedName: {0}", qualifiedName));
            Trace.WriteLine(String.Format("GetDeclarationSource: Line = {0}, Column = {1}", Request.Line, Request.Col));

            return base.GetDeclarationSource(qualifiedName);
        }
    }
}
